/**
 * Project Name:sc-parent-service
 * File Name:EmployeeServiceImpl.java
 * Package Name:com.sc.service.impl
 * Date:2018年6月28日上午11:47:11
 * Copyright (c) 2018, bluemobi All Rights Reserved.
 */

package com.sc.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sc.mapper.mapperhand.HandemployeeMapper;
import com.sc.pojo.Employee;
import com.sc.service.EmployeeService;

/**
 * Description: <br/>
 * Date: 2018年6月28日 上午11:47:11 <br/>
 * 
 * @author pengchengwang
 * @version
 * @see
 */
@Service
public class EmployeeServiceImpl implements EmployeeService {
    @Autowired
    private HandemployeeMapper employeeMapper;

    /**
     * 
     * 通过用户名和密码查询登陆用户的信息<br/>
     * 查询之后可以获得员工的状态如果是没有离职并且是第一次登陆就需要提示修改密码
     * 
     * @see com.sc.service.EmployeeService#selectBynameAndPassWord(com.sc.pojo.Employee)
     */
    @Override
    public List<Employee> selectBynameAndPassWord(Employee employee) {

        // Auto-generated method stub
        return employeeMapper.selectBynameAndPassWord(employee);
    }

    /**
     * 
     * 查询所有员工的信息
     * 
     * @see com.sc.service.EmployeeService#selectAllEmployeeInfo()
     */
    @Override
    public List<Employee> selectAllEmployeeInfo() {

        // Auto-generated method stub
        return employeeMapper.selectAllEmployeeInfo();
    }

    /**
     * 当员工第一次登陆进来时通过id修改员工的密码
     *
     * @see com.sc.service.EmployeeService#updateEmployeePassWord(com.sc.pojo.Employee)
     */
    @Override
    @Transactional
    public boolean updateEmployeePassWord(Employee employee) {
        boolean flag = false;
        int num = employeeMapper.updateEmployeePassWord(employee);
        if (num >= 1) {
            flag = true;
        }
        // Auto-generated method stub
        return flag;
    }

    /**
     * 根据员工的id修改员工的电话,当解绑成功新手机号验证成功才进行修改数据
     *
     * @see com.sc.service.EmployeeService#EmployeePhoneById(com.sc.pojo.Employee)
     */
    @Override
    @Transactional
    public boolean EmployeePhoneById(Employee employee) {
        boolean flag = false;
        int num = employeeMapper.EmployeePhoneById(employee);
        if (num >= 1) {
            flag = true;
        }
        // Auto-generated method stub
        return flag;
    }

    /**
     * 修改员工的密码
     *
     * @see com.sc.service.EmployeeService#EmployeeEPassWordById(com.sc.pojo.Employee)
     */
    @Override
    @Transactional
    public boolean EmployeeEPassWordById(Employee employee) {
        boolean flag = false;
        int num = employeeMapper.EmployeeEPassWordById(employee);
        if (num >= 1) {
            flag = true;
        }
        // Auto-generated method stub
        return flag;
    }

    /**
     * 根据员工id修改员工可改信息
     *
     * @see com.sc.service.EmployeeService#UpdateEmpInfoById(com.sc.pojo.Employee)
     */
    @Override
    @Transactional
    public boolean UpdateEmpInfoById(Employee employee) {
        boolean flag = false;
        int num = employeeMapper.UpdateEmpInfoById(employee);
        if (num >= 1) {
            flag = true;
        }
        // Auto-generated method stub
        return flag;
    }

    /**
     * 注销员工信息,当员工离职时将员工的状态改为0，在职时为1
     *
     * @see com.sc.service.EmployeeService#updateEmployeeInfoById(int)
     */
    @Override
    @Transactional
    public boolean updateEmployeeInfoById(int id) {
        boolean flag = false;
        int num = employeeMapper.updateEmployeeInfoById(id);
        if (num >= 1) {
            flag = true;
        }
        // Auto-generated method stub
        return flag;
    }

    @Override
    public List<Employee> queryGetMoneyAndCountAndAreaByDay() {

        // Auto-generated method stub
        return employeeMapper.queryGetMoneyAndCountAndAreaByDay();
    }

    @Override
    public List<Employee> queryGetMoneyAndCountAndAreaByWeek() {

        // Auto-generated method stub
        return employeeMapper.queryGetMoneyAndCountAndAreaByWeek();
    }

    @Override
    public List<Employee> queryGetMoneyAndCountAndAreaByMonth() {

        // Auto-generated method stub
        return employeeMapper.queryGetMoneyAndCountAndAreaByMonth();
    }

    @Override
    public List<Employee> queryGetMoneyAndCountAndAreaByYear() {

        // Auto-generated method stub
        return employeeMapper.queryGetMoneyAndCountAndAreaByYear();
    }

    @Override
    public List<Employee> selectWorkloadByDay() {

        // Auto-generated method stub
        return employeeMapper.selectWorkloadByDay();
    }

    @Override
    public List<Employee> selectWorkloadByWeek() {

        // Auto-generated method stub
        return employeeMapper.selectWorkloadByWeek();
    }

    @Override
    public List<Employee> selectWorkloadByMonth() {

        // Auto-generated method stub
        return employeeMapper.selectWorkloadByMonth();
    }

    @Override
    public List<Employee> selectWorkloadByUpMonth() {

        // Auto-generated method stub
        return employeeMapper.selectWorkloadByMonth();
    }

    @Override
    public List<Employee> selectWorkloadByQuarter() {

        // Auto-generated method stub
        return employeeMapper.selectWorkloadByQuarter();
    }

    @Override
    public List<Employee> selectWorkloadByUpQuarter() {

        // Auto-generated method stub
        return employeeMapper.selectWorkloadByUpQuarter();
    }

    @Override
    public List<Employee> selectWorkloadByYear() {

        // Auto-generated method stub
        return employeeMapper.selectWorkloadByYear();
    }

}
